<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/12/30
 * Time: 9:18
 */

?>


<?php

require_once "../DB_Util/sql_helper.php";

//先得到用户id(从浏览器返回的)
$id = $_POST["id"];
//
//$sql = "DELETE FROM articles WHERE id = {$id} ";
//
//$connect = mysqli_connect("127.0.0.1","root","root","alibaixiu");
//
//mysqli_set_charset($connect,"utf8");
//
//$res = mysqli_query($connect,$sql);

//直接调用封装好的方法删除数据的方法
$res = deleteById("articles",$id);

$arr = array("code"=>200,"msg"=>"操作失败");

if ($res == 100){
    $arr["code"] = 100;
    $arr["msg"] = "操作成功";
}

echo json_encode($arr,JSON_UNESCAPED_UNICODE);

?>
